
set(notification-ukcc-plugin_LIB_SRCS
        notification-ukcc-plugin.cpp
        notification-ukcc-plugin.h
        notice-menu.cpp
        notice-menu.h)

find_package(QT NAMES Qt6 Qt5 COMPONENTS Core Widgets LinguistTools REQUIRED)
find_package(Qt${QT_VERSION_MAJOR} COMPONENTS Core Widgets LinguistTools REQUIRED)
find_package(PkgConfig REQUIRED)
set(UKUI_NOTIFICATION_EXTERNAL_LIBS "")
set(UKUI_NOTIFICATION_PC_PKGS kysdk-qtwidgets)

foreach(PC_LIB IN ITEMS ${UKUI_NOTIFICATION_PC_PKGS})
    pkg_check_modules(${PC_LIB} REQUIRED ${PC_LIB})
    if(${${PC_LIB}_FOUND})
        include_directories(${${PC_LIB}_INCLUDE_DIRS})
        link_directories(${${PC_LIB}_LIBRARY_DIRS})
        list(APPEND UKUI_NOTIFICATION_EXTERNAL_LIBS ${${PC_LIB}_LIBRARIES})
    endif()
endforeach()

include_directories(${Qt5Core_INCLUDE_DIRS} ${Qt5Widgets_INCLUDE_DIRS})
include_directories(../libukui-notification/notification-settings)
include_directories(../libukui-notification)


file(GLOB TS_FILES "${PROJECT_SOURCE_DIR}/notification-ukcc-plugin/translations/*.ts")
qt5_add_translation(QM_FILES ${TS_FILES})
#set(QM_FILES ${QM_FILES} PARENT_SCOPE)
add_custom_target(translations ALL DEPENDS ${QM_FILES})

add_library(notification-ukcc-plugin SHARED
    ${notification-ukcc-plugin_LIB_SRCS}
    ${QM_FILES}
    )

target_link_libraries(notification-ukcc-plugin
        PRIVATE
        Qt${QT_VERSION_MAJOR}::Core
        Qt${QT_VERSION_MAJOR}::DBus
        Qt${QT_VERSION_MAJOR}::Network
        ukui-notification
        ukcc
        )

install(TARGETS notification-ukcc-plugin DESTINATION /usr/lib/${CMAKE_LIBRARY_ARCHITECTURE}/ukui-control-center)
install(FILES ${TS_FILES} ${QM_FILES} DESTINATION /usr/share/ukui-notification/notification-ukcc-plugin/translations)

